package yangsw87.basic;

public class J10_Ex72_OOPb {

	public static void main(String[] args) {

		Retangle re = new Retangle();

		re.setWidth(4);
		re.setHeight(40);
		re.setColor("red");
		System.out.println(re.toString());

		re.setWidth(3.5);
		re.setHeight(35.9);
		re.setColor("orange");
		System.out.println(re.toString());
	}

}

class Retangle {
	private double width;
	private double height;
	private String color;

	private double area;
	private double circum;

	public void setWidth(double width) {
		this.width = width;
	}

	public void setHeight(double height) {
		this.height = height;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public void setArea(int area) {
		this.area = area;
	}

	public void setCircum(int circum) {
		this.circum = circum;
	}

	// setter

	public double getWidth() {
		return width;
	}

	public double getHeight() {
		return height;
	}

	public String getColor() {
		return color;
	}

	public double getArea() {
		area = width * height;
		return area;
	}

	public double getCircum() {
		circum = (width + height) * 2;
		return circum;
	}

	// getter

	@Override
	public String toString() {
		String result = "";
		result = result + " 가로 : " + width + "\n";
		result += " 세로 : " + height + "\n";
		result += " 색깔 : " + color + "\n";

		result += " 면적 : " + getArea() + "\n";
		result += " 둘레 : " + getCircum() + "\n";

		return result;
	}
}
